package com.inspur.security.cbb3.kms.enums;

/**
 * DataActionType
 *
 * @author liukai
 * @date 2020/10/20
 **/
public enum AlgorithmType {
    /**
     * 其他
     */
    other(new String[]{}),

    /**
     * asymmetric
     */
    rsa(new String[]{"1024", "2048", "4096"}),
    dsa(new String[]{"1024", "2048"}),
    sm2(new String[]{"256"}),

    /**
     * symmetric
     */
    desede(new String[]{"128","192"}),
    aes(new String[]{"128","192","256"}),
    sm4(new String[]{"128"}),

    /**
     * hash
     */
    sm3(new String[]{}),
    md5(new String[]{}),
    sha1(new String[]{}),
    sha256(new String[]{});

    String[] bitLength;

    AlgorithmType(String[] bitLength){
        this.bitLength = bitLength;
    }

    public String[] getBitLength() {
        return bitLength;
    }

    public static AlgorithmType getByType(String type){
        for (AlgorithmType constants : values()) {
            if (constants.name().equalsIgnoreCase(type)) {
                return constants;
            }
        }
        return other;
    }

}
